package com.example.service02.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.lang.Dict;
import com.framework.common.api.CommonResult;
import com.framework.common.auto.ThreadLocalUtils;
import com.framework.common.auto.TokenUserInfo;
import com.framework.common.auto.UserInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lihanbo
 */
@RestController
@Slf4j
public class Service02Controller {

    //验证接口权限
    @SaCheckPermission("api:service02:test")
    @PostMapping("/test")
    public CommonResult<?> test() {
        //获取登陆的用户信息
        TokenUserInfo tokenUserInfo = ThreadLocalUtils.getTokenUserInfo();
        return CommonResult.success(Dict.create().set("pro", "Service02").set("tokenUserInfo", tokenUserInfo));
    }

}
